public class test06 {
    public int removeElement(int[] nums, int val) {
        //双指针
        int left = 0,right = 0;
        while(left<=right && right<nums.length){
            if(nums[right]!=val){
                nums[left++] = nums[right];
            }
            right++;
        }
        return left;
    }
}
